import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SiteCommentsVO, SiteCommentsForm, SiteCommentsQuery } from '@/api/comment/siteComments/types';

/**
 * 查询钓场评论列表
 * @param query
 * @returns {*}
 */

export const listSiteComments = (query?: SiteCommentsQuery): AxiosPromise<SiteCommentsVO[]> => {
  return request({
    url: '/comment/siteComments/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询钓场评论详细
 * @param commentsId
 */
export const getSiteComments = (commentsId: string | number): AxiosPromise<SiteCommentsVO> => {
  return request({
    url: '/comment/siteComments/' + commentsId,
    method: 'get'
  });
};

/**
 * 新增钓场评论
 * @param data
 */
export const addSiteComments = (data: SiteCommentsForm) => {
  return request({
    url: '/comment/siteComments',
    method: 'post',
    data: data
  });
};

/**
 * 修改钓场评论
 * @param data
 */
export const updateSiteComments = (data: SiteCommentsForm) => {
  return request({
    url: '/comment/siteComments',
    method: 'put',
    data: data
  });
};

/**
 * 删除钓场评论
 * @param commentsId
 */
export const delSiteComments = (commentsId: string | number | Array<string | number>) => {
  return request({
    url: '/comment/siteComments/' + commentsId,
    method: 'delete'
  });
};
